home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 December / CHIP_12_2002.iso / Internet / CuteFTP Pro 3.0beta / cuteftppro30b.exe / Disk1 / data1.cab / GUI_Default_Script / sample.vbs
Encoding:
Text File  |  2002-10-16  |  3.1 KB  |  77 lines

  1. '********************************************************************
  2. '* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3. '* CuteFTP Pro Script Template
  4. '* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  5. '*This default template script is in VBScript. You can write
  6. '*scripts in your language of choice and save it with the proper
  7. '*extenstion, or use your an editor specific to that language.
  8. '*
  9. '*
  10. '*See the TESDK help file for more details on how this scripting 
  11. '*feature works.
  12. '*You must have Windows Scripting Host installed for the COM enabled
  13. '*engine to work
  14. '*
  15. '*****************************************************************
  16. 'Look into c:\temp folder to observe local activity (for testing purposes)
  17. 'or Right Click on the Transfer Engine icon in the systray and select "show current transfers"
  18. 'Uses an anonymous login to ftp://kyle.globalscape.net
  19.  
  20.    'First declare a variable called Mysite. This will hold the
  21.    'reference to the TE COM object.
  22.    Dim MySite
  23.  
  24.    'Creating a connection object and assign it to the variable
  25.    Set MySite = CreateObject("CuteFTPPro.TEConnection")
  26.     
  27.    ' Now set each property for the site connection 
  28.    ' You can omit this section to use the default values, but
  29.    ' you should at least specify the Host
  30.     'The default Protocol is FTP, however SFTP (SSH2), FTPS (SSL), HTTP, and HTTPS can also be used)
  31.    MySite.Protocol = "FTP"
  32.    MySite.Host = "kyle.globalscape.com"
  33.    'following lines are optional since the default is anonymous if no login and password are defined
  34.    MySite.Login = "anonymous"
  35.    MySite.Password = "user@user.com"
  36.    'if necessary, use the UseProxy method and ProxyInfo or SocksInfo properties to connect through a proxy server
  37.    MySite.UseProxy = "BOTH"
  38.    'now connect to the site (also called called implicitly when a remote method is called)
  39.    MySite.Connect
  40.  
  41.    If (Not Cbool(MySite.IsConnected)) Then    
  42.       MsgBox "Could not connect to: " & MySite.Host & "!"
  43.       Quit(1)
  44.    End If
  45.  
  46.    ' If we get this far, our connection has been established.
  47.     
  48.     'the script will check if the local folder c:\temp exists and create it if necessary
  49.    If (Not (MySite.LocalExists("c:\temp"))) Then
  50.       'Create it if necessary
  51.       MySite.CreateLocalFolder "c:\temp"
  52.    End If
  53.  
  54.    ' Change TE's local working folder to to c:\temp
  55.    MySite.LocalFolder = "c:\temp"
  56.  
  57.    ' Check for existence of remote folder "/pub/cuteftp"
  58.    b = MySite.RemoteExists("/pub/cuteftp/")
  59.  
  60.    If (Not CBool(b)) Then
  61.       'tell the user that the folder was not found and quit since i have no
  62.       ' permission to create the remote folder anyway
  63.       MsgBox "Remote folder not found!. Please make sure that the Pub folder exists on the remote site"
  64.       Quit(1)
  65.    End If
  66.  
  67.    ' Now download the index file to the local destination folder
  68.    MySite.Download "/pub/cuteftp/index.txt"
  69.  
  70.    ' Complete.  Show the status of this transfer.
  71.    MsgBox "Task done, final status is '" + MySite.Status + "'"
  72.  
  73.  
  74. 'End of sample script.
  75. ' You can save you script and then run it by either selecting it from the Tools > Run
  76. ' Script menu of by double clicking on the script file in Windows
  77.